<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<title>Command Grammar Lines</title>
<link href="../docs-assets/Breadcrumbs.css" rel="stylesheet" rev="stylesheet" type="text/css">
		<meta name="viewport" content="width=device-width initial-scale=1">
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
		<meta http-equiv="Content-Language" content="en-gb">

<link href="../docs-assets/Contents.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Progress.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Navigation.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Fonts.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Base.css" rel="stylesheet" rev="stylesheet" type="text/css">
<script>
function togglePopup(material_id) {
  var popup = document.getElementById(material_id);
  popup.classList.toggle("show");
}
</script>

<link href="../docs-assets/Popups.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Colours.css" rel="stylesheet" rev="stylesheet" type="text/css">
		
	</head>
	<body class="commentary-font">
		<nav role="navigation">
		<h1><a href="../index.html"><img src="../docs-assets/Inform.png" height=72> </a></h1>
<ul><li><a href="../index.html">home</a></li>
</ul><h2>Compiler</h2><ul>
<li><a href="../structure.html">structure</a></li>
<li><a href="../inbuildn.html">inbuild</a></li>
<li><a href="../inform7n.html">inform7</a></li>
<li><a href="../intern.html">inter</a></li>
<li><a href="../services.html">services</a></li>
<li><a href="../secrets.html">secrets</a></li>
</ul><h2>Other Tools</h2><ul>
<li><a href="../inblorbn.html">inblorb</a></li>
<li><a href="../inform6.html">inform6</a></li>
<li><a href="../inpolicyn.html">inpolicy</a></li>
</ul><h2>Resources</h2><ul>
<li><a href="../extensions.html">extensions</a></li>
<li><a href="../kits.html">kits</a></li>
</ul><h2>Repository</h2><ul>
<li><a href="https://github.com/ganelson/inform"><img src="../docs-assets/github.png" height=0> github</a></li>
</ul><h2>Related Projects</h2><ul>
<li><a href="https://github.com/ganelson/inweb"><img src="../docs-assets/github.png" height=0> inweb</a></li>
<li><a href="https://github.com/ganelson/intest"><img src="../docs-assets/github.png" height=0> intest</a></li>
</ul>
		</nav>
		<main role="main">
		<!-- Weave of 'Command Grammar Lines' generated by inweb -->
<div class="breadcrumbs">
    <ul class="crumbs"><li><a href="../index.html">Home</a></li><li><a href="../inform7n.html">Inform7</a></li><li><a href="index.html">runtime</a></li><li><a href="index.html#7">Chapter 7: Command Grammar</a></li><li><b>Command Grammar Lines</b></li></ul></div>
<p class="purpose">Compiling lines of command parser grammar.</p>

<ul class="toc"><li><a href="7-cgl.html#SP1">&#167;1. Compilation data</a></li><li><a href="7-cgl.html#SP6">&#167;6. Compilation</a></li><li><a href="7-cgl.html#SP7">&#167;7. Mistaken grammar lines</a></li><li><a href="7-cgl.html#SP10">&#167;10. Conditional grammar lines</a></li><li><a href="7-cgl.html#SP12">&#167;12. Slash GPRs</a></li><li><a href="7-cgl.html#SP14">&#167;14. Compiling token ranges</a></li></ul><hr class="tocbar">

<p class="commentary firstcommentary"><a id="SP1" class="paragraph-anchor"></a><b>&#167;1. Compilation data.</b>Each <span class="extract"><span class="extract-syntax">cg_line</span></span> object contains this data, though except for the <span class="extract"><span class="extract-syntax">suppress_compilation</span></span>
flag, most of it is rarely used:
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">typedef</span><span class="plain-syntax"> </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="reserved-syntax">cg_line_compilation_data</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="identifier-syntax">package_request</span><span class="plain-syntax"> *</span><span class="identifier-syntax">metadata_package</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="identifier-syntax">inter_name</span><span class="plain-syntax"> *</span><span class="identifier-syntax">xref_iname</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">suppress_compilation</span><span class="plain-syntax">; </span><span class="comment-syntax"> has been compiled in a single grammar token already?</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="identifier-syntax">inter_name</span><span class="plain-syntax"> *</span><span class="identifier-syntax">cond_token_iname</span><span class="plain-syntax">; </span><span class="comment-syntax"> for its </span><span class="extract"><span class="extract-syntax">Cond_Token_*</span></span><span class="comment-syntax"> routine, if any</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">cond_token_compiled</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="identifier-syntax">inter_name</span><span class="plain-syntax"> *</span><span class="identifier-syntax">mistake_iname</span><span class="plain-syntax">; </span><span class="comment-syntax"> for its </span><span class="extract"><span class="extract-syntax">Mistake_Token_*</span></span><span class="comment-syntax"> routine, if any</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="identifier-syntax">cg_line</span><span class="plain-syntax"> *</span><span class="identifier-syntax">next_with_action</span><span class="plain-syntax">; </span><span class="comment-syntax"> used when indexing actions</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="identifier-syntax">command_grammar</span><span class="plain-syntax"> *</span><span class="identifier-syntax">belongs_to_cg</span><span class="plain-syntax">; </span><span class="comment-syntax"> similarly, used only in indexing</span>
<span class="plain-syntax">} </span><span class="reserved-syntax">cg_line_compilation_data</span><span class="plain-syntax">;</span>

<span class="reserved-syntax">cg_line_compilation_data</span><span class="plain-syntax"> </span><span class="function-syntax">RTCommandGrammarLines::new_compilation_data</span><span class="plain-syntax">(</span><span class="identifier-syntax">cg_line</span><span class="plain-syntax"> *</span><span class="identifier-syntax">cg</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">cg_line_compilation_data</span><span class="plain-syntax"> </span><span class="identifier-syntax">cglcd</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">cglcd</span><span class="plain-syntax">.</span><span class="element-syntax">metadata_package</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">cglcd</span><span class="plain-syntax">.</span><span class="element-syntax">xref_iname</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">cglcd</span><span class="plain-syntax">.</span><span class="element-syntax">suppress_compilation</span><span class="plain-syntax"> = </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">cglcd</span><span class="plain-syntax">.</span><span class="element-syntax">cond_token_iname</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">cglcd</span><span class="plain-syntax">.</span><span class="element-syntax">cond_token_compiled</span><span class="plain-syntax"> = </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">cglcd</span><span class="plain-syntax">.</span><span class="element-syntax">mistake_iname</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">cglcd</span><span class="plain-syntax">.</span><span class="element-syntax">belongs_to_cg</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">cglcd</span><span class="plain-syntax">.</span><span class="element-syntax">next_with_action</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">cglcd</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>
</pre>
<ul class="endnotetexts"><li>The structure cg_line_compilation_data is accessed in 5/kc, 7/cg and here.</li></ul>
<p class="commentary firstcommentary"><a id="SP2" class="paragraph-anchor"></a><b>&#167;2. </b>So this is where some lines in a command grammar's list are flagged to be
suppressed.
</p>

<p class="commentary">It's called when the <span class="extract"><span class="extract-syntax">name</span></span> property array is being compiled, and what it
does is to notice when a line contains just a single word, and if so, compile
that as an extra entry for the <span class="extract"><span class="extract-syntax">name</span></span> array, then mark it to be skipped when
a <span class="extract"><span class="extract-syntax">parse_name</span></span> function is being compiled. Effectively, then, it moves this
content from <span class="extract"><span class="extract-syntax">parse_name</span></span> to <span class="extract"><span class="extract-syntax">name</span></span>, an optimisation which is just a little
faster for the command parser to deal with, and saves a few bytes at runtime.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="function-syntax">RTCommandGrammarLines::list_take_out_one_word_grammar</span><button class="popup" onclick="togglePopup('usagePopup1')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup1">Usage of <span class="code-font"><span class="function-syntax">RTCommandGrammarLines::list_take_out_one_word_grammar</span></span>:<br/>Name Properties - <a href="7-np.html#SP4">&#167;4</a></span></button><span class="plain-syntax">(</span><span class="identifier-syntax">command_grammar</span><span class="plain-syntax"> *</span><span class="identifier-syntax">cg</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">entries_made</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">cg</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">cg_is</span><span class="plain-syntax"> != </span><span class="identifier-syntax">CG_IS_SUBJECT</span><span class="plain-syntax">)</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">internal_error</span><span class="plain-syntax">(</span><span class="string-syntax">"One-word optimisation applies only to CG_IS_SUBJECT"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">LOOP_THROUGH_UNSORTED_CG_LINES</span><span class="plain-syntax">(</span><span class="identifier-syntax">cgl</span><span class="plain-syntax">, </span><span class="identifier-syntax">cg</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">wn</span><span class="plain-syntax"> = </span><span class="identifier-syntax">CGLines::cgl_contains_single_unconditional_word</span><span class="plain-syntax">(</span><span class="identifier-syntax">cgl</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">wn</span><span class="plain-syntax"> &gt;= </span><span class="constant-syntax">0</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">TEMPORARY_TEXT</span><span class="plain-syntax">(</span><span class="identifier-syntax">content</span><span class="plain-syntax">)</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">WRITE_TO</span><span class="plain-syntax">(</span><span class="identifier-syntax">content</span><span class="plain-syntax">, </span><span class="string-syntax">"%w"</span><span class="plain-syntax">, </span><span class="identifier-syntax">Lexer::word_text</span><span class="plain-syntax">(</span><span class="identifier-syntax">wn</span><span class="plain-syntax">));</span>
<span class="plain-syntax">            </span><a href="2-ea.html#SP4" class="function-link"><span class="function-syntax">EmitArrays::dword_entry</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">content</span><span class="plain-syntax">); </span><span class="identifier-syntax">entries_made</span><span class="plain-syntax">++;</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">DISCARD_TEXT</span><span class="plain-syntax">(</span><span class="identifier-syntax">content</span><span class="plain-syntax">)</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">cgl</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">compilation_data</span><span class="plain-syntax">.</span><span class="element-syntax">suppress_compilation</span><span class="plain-syntax"> = </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">entries_made</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP3" class="paragraph-anchor"></a><b>&#167;3. </b>These inames are used only by two special forms of CG line: see below. For the
great majority of lines, both will remain <span class="extract"><span class="extract-syntax">NULL</span></span>.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="identifier-syntax">inter_name</span><span class="plain-syntax"> *</span><span class="function-syntax">RTCommandGrammarLines::get_cond_token_iname</span><button class="popup" onclick="togglePopup('usagePopup2')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup2">Usage of <span class="code-font"><span class="function-syntax">RTCommandGrammarLines::get_cond_token_iname</span></span>:<br/><a href="7-cgl.html#SP10">&#167;10</a>, <a href="7-cgl.html#SP11">&#167;11</a></span></button><span class="plain-syntax">(</span><span class="identifier-syntax">cg_line</span><span class="plain-syntax"> *</span><span class="identifier-syntax">cgl</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">cgl</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">compilation_data</span><span class="plain-syntax">.</span><span class="element-syntax">cond_token_iname</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">)</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">cgl</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">compilation_data</span><span class="plain-syntax">.</span><span class="element-syntax">cond_token_iname</span><span class="plain-syntax"> =</span>
<span class="plain-syntax">            </span><a href="2-hrr.html#SP12" class="function-link"><span class="function-syntax">Hierarchy::make_iname_in</span></a><span class="plain-syntax">(</span><span class="constant-syntax">CONDITIONAL_TOKEN_FN_HL</span><span class="plain-syntax">,</span>
<span class="plain-syntax">                </span><a href="2-hrr.html#SP20" class="function-link"><span class="function-syntax">Hierarchy::completion_package</span></a><span class="plain-syntax">(</span><span class="constant-syntax">COND_TOKENS_HAP</span><span class="plain-syntax">));</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">cgl</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">compilation_data</span><span class="plain-syntax">.</span><span class="element-syntax">cond_token_iname</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>

<span class="identifier-syntax">inter_name</span><span class="plain-syntax"> *</span><span class="function-syntax">RTCommandGrammarLines::get_mistake_iname</span><button class="popup" onclick="togglePopup('usagePopup3')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup3">Usage of <span class="code-font"><span class="function-syntax">RTCommandGrammarLines::get_mistake_iname</span></span>:<br/><a href="7-cgl.html#SP7">&#167;7</a></span></button><span class="plain-syntax">(</span><span class="identifier-syntax">cg_line</span><span class="plain-syntax"> *</span><span class="identifier-syntax">cgl</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">cgl</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">compilation_data</span><span class="plain-syntax">.</span><span class="element-syntax">mistake_iname</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">)</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">cgl</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">compilation_data</span><span class="plain-syntax">.</span><span class="element-syntax">mistake_iname</span><span class="plain-syntax"> =</span>
<span class="plain-syntax">            </span><a href="2-hrr.html#SP12" class="function-link"><span class="function-syntax">Hierarchy::make_iname_in</span></a><span class="plain-syntax">(</span><span class="constant-syntax">MISTAKE_FN_HL</span><span class="plain-syntax">,</span>
<span class="plain-syntax">                </span><a href="2-hrr.html#SP20" class="function-link"><span class="function-syntax">Hierarchy::completion_package</span></a><span class="plain-syntax">(</span><span class="constant-syntax">MISTAKES_HAP</span><span class="plain-syntax">));</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">cgl</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">compilation_data</span><span class="plain-syntax">.</span><span class="element-syntax">mistake_iname</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP4" class="paragraph-anchor"></a><b>&#167;4. </b>Grammar lines are typically indexed twice: the other time is when all
grammar lines belonging to a given action are tabulated. Special linked
lists are kept for this purpose, and this is where we unravel them and
print to the index. The question of sorted vs unsorted is meaningless
here, since the CGLs appearing in such a list will typically belong to
several different CGs. (As it happens, they appear in order of creation,
i.e., in source text order.)
</p>

<p class="commentary">Tiresomely, all of this means that we need to store "uphill" pointers
in CGLs: back up to the CGs that own them. The following routine does
this for a whole list of CGLs:
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">RTCommandGrammarLines::list_assert_ownership</span><button class="popup" onclick="togglePopup('usagePopup4')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup4">Usage of <span class="code-font"><span class="function-syntax">RTCommandGrammarLines::list_assert_ownership</span></span>:<br/>Command Grammars - <a href="7-cg.html#SP16">&#167;16</a></span></button><span class="plain-syntax">(</span><span class="identifier-syntax">command_grammar</span><span class="plain-syntax"> *</span><span class="identifier-syntax">cg</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">LOOP_THROUGH_UNSORTED_CG_LINES</span><span class="plain-syntax">(</span><span class="identifier-syntax">cgl</span><span class="plain-syntax">, </span><span class="identifier-syntax">cg</span><span class="plain-syntax">)</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">cgl</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">compilation_data</span><span class="plain-syntax">.</span><span class="element-syntax">belongs_to_cg</span><span class="plain-syntax"> = </span><span class="identifier-syntax">cg</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP5" class="paragraph-anchor"></a><b>&#167;5. </b>And this routine accumulates the per-action lists of CGLs:
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">RTCommandGrammarLines::list_with_action_add</span><span class="plain-syntax">(</span><span class="identifier-syntax">cg_line</span><span class="plain-syntax"> *</span><span class="identifier-syntax">list_head</span><span class="plain-syntax">, </span><span class="identifier-syntax">cg_line</span><span class="plain-syntax"> *</span><span class="identifier-syntax">cgl</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">list_head</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">) </span><span class="identifier-syntax">internal_error</span><span class="plain-syntax">(</span><span class="string-syntax">"tried to add to null action list"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">while</span><span class="plain-syntax"> (</span><span class="identifier-syntax">list_head</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">compilation_data</span><span class="plain-syntax">.</span><span class="element-syntax">next_with_action</span><span class="plain-syntax">)</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">list_head</span><span class="plain-syntax"> = </span><span class="identifier-syntax">list_head</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">compilation_data</span><span class="plain-syntax">.</span><span class="element-syntax">next_with_action</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">list_head</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">compilation_data</span><span class="plain-syntax">.</span><span class="element-syntax">next_with_action</span><span class="plain-syntax"> = </span><span class="identifier-syntax">cgl</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP6" class="paragraph-anchor"></a><b>&#167;6. Compilation.</b>Some grammar lines compile as a run of array entries (those for CG_IS_COMMAND),
and others are compiled into code which matches them.
</p>

<p class="commentary">"Genuinely verbal" grammar is grammar beginning with a command verb; that will
be most, but not all, CG_IS_COMMAND grammars, and no others.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">RTCommandGrammarLines::compile_cg_line</span><button class="popup" onclick="togglePopup('usagePopup5')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup5">Usage of <span class="code-font"><span class="function-syntax">RTCommandGrammarLines::compile_cg_line</span></span>:<br/>Command Grammars - <a href="7-cg.html#SP16">&#167;16</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">gpr_kit</span><span class="plain-syntax"> *</span><span class="identifier-syntax">kit</span><span class="plain-syntax">, </span><span class="identifier-syntax">cg_line</span><span class="plain-syntax"> *</span><span class="identifier-syntax">cgl</span><span class="plain-syntax">, </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">cg_is</span><span class="plain-syntax">,</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">genuinely_verbal</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">LOGIF</span><span class="plain-syntax">(</span><span class="identifier-syntax">GRAMMAR</span><span class="plain-syntax">, </span><span class="string-syntax">"Compiling grammar line: $g\n"</span><span class="plain-syntax">, </span><span class="identifier-syntax">cgl</span><span class="plain-syntax">);</span>

<span class="plain-syntax">    </span><span class="identifier-syntax">current_sentence</span><span class="plain-syntax"> = </span><span class="identifier-syntax">cgl</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">where_grammar_specified</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><a href="2-gpr.html#SP4" class="function-link"><span class="function-syntax">GPRs::begin_line</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">kit</span><span class="plain-syntax">);</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">cg_is</span><span class="plain-syntax"> == </span><span class="identifier-syntax">CG_IS_COMMAND</span><span class="plain-syntax">) </span><span class="named-paragraph-container code-font"><a href="7-cgl.html#SP6_1" class="named-paragraph-link"><span class="named-paragraph">Compile CG_IS_COMMAND line-starting material</span><span class="named-paragraph-number">6.1</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">cg_is</span><span class="plain-syntax"> == </span><span class="identifier-syntax">CG_IS_VALUE</span><span class="plain-syntax">) </span><span class="named-paragraph-container code-font"><a href="7-cgl.html#SP6_2" class="named-paragraph-link"><span class="named-paragraph">Compile CG_IS_VALUE line-starting material</span><span class="named-paragraph-number">6.2</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">CGLines::conditional</span><span class="plain-syntax">(</span><span class="identifier-syntax">cgl</span><span class="plain-syntax">))</span>
<span class="plain-syntax">        </span><a href="7-cgl.html#SP10" class="function-link"><span class="function-syntax">RTCommandGrammarLines::cgl_compile_extra_token_for_condition</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">kit</span><span class="plain-syntax">, </span><span class="identifier-syntax">cgl</span><span class="plain-syntax">, </span><span class="identifier-syntax">cg_is</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">cgl</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">mistaken</span><span class="plain-syntax">)</span>
<span class="plain-syntax">        </span><a href="7-cgl.html#SP7" class="function-link"><span class="function-syntax">RTCommandGrammarLines::cgl_compile_extra_token_for_mistake</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">cgl</span><span class="plain-syntax">, </span><span class="identifier-syntax">cg_is</span><span class="plain-syntax">);</span>

<span class="plain-syntax">    </span><span class="identifier-syntax">cg_token</span><span class="plain-syntax"> *</span><span class="identifier-syntax">token_from</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">, *</span><span class="identifier-syntax">token_to</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="named-paragraph-container code-font"><a href="7-cgl.html#SP6_3" class="named-paragraph-link"><span class="named-paragraph">Find the token range</span><span class="named-paragraph-number">6.3</span></a></span><span class="plain-syntax">;</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">problem_count</span><span class="plain-syntax"> == </span><span class="constant-syntax">0</span><span class="plain-syntax">)</span>
<span class="plain-syntax">        </span><a href="7-cgl.html#SP14" class="function-link"><span class="function-syntax">RTCommandGrammarLines::compile_token_range</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">kit</span><span class="plain-syntax">, </span><span class="identifier-syntax">token_from</span><span class="plain-syntax">, </span><span class="identifier-syntax">token_to</span><span class="plain-syntax">,</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">cg_is</span><span class="plain-syntax">, </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">);</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">cg_is</span><span class="plain-syntax"> == </span><span class="identifier-syntax">CG_IS_COMMAND</span><span class="plain-syntax">) </span><span class="named-paragraph-container code-font"><a href="7-cgl.html#SP6_4" class="named-paragraph-link"><span class="named-paragraph">Compile CG_IS_COMMAND line-ending material</span><span class="named-paragraph-number">6.4</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">cg_is</span><span class="plain-syntax"> == </span><span class="identifier-syntax">CG_IS_PROPERTY_NAME</span><span class="plain-syntax">) || (</span><span class="identifier-syntax">cg_is</span><span class="plain-syntax"> == </span><span class="identifier-syntax">CG_IS_TOKEN</span><span class="plain-syntax">))</span>
<span class="plain-syntax">        </span><span class="named-paragraph-container code-font"><a href="7-cgl.html#SP6_5" class="named-paragraph-link"><span class="named-paragraph">Compile CG_IS_PROPERTY_NAME or CG_IS_TOKEN line-ending material</span><span class="named-paragraph-number">6.5</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">cg_is</span><span class="plain-syntax"> == </span><span class="identifier-syntax">CG_IS_CONSULT</span><span class="plain-syntax">) </span><span class="named-paragraph-container code-font"><a href="7-cgl.html#SP6_6" class="named-paragraph-link"><span class="named-paragraph">Compile CG_IS_CONSULT line-ending material</span><span class="named-paragraph-number">6.6</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">cg_is</span><span class="plain-syntax"> == </span><span class="identifier-syntax">CG_IS_SUBJECT</span><span class="plain-syntax">) </span><span class="named-paragraph-container code-font"><a href="7-cgl.html#SP6_7" class="named-paragraph-link"><span class="named-paragraph">Compile CG_IS_SUBJECT line-ending material</span><span class="named-paragraph-number">6.7</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">cg_is</span><span class="plain-syntax"> == </span><span class="identifier-syntax">CG_IS_VALUE</span><span class="plain-syntax">) </span><span class="named-paragraph-container code-font"><a href="7-cgl.html#SP6_8" class="named-paragraph-link"><span class="named-paragraph">Compile CG_IS_VALUE line-ending material</span><span class="named-paragraph-number">6.8</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP6_1" class="paragraph-anchor"></a><b>&#167;6.1. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Compile CG_IS_COMMAND line-starting material</span><span class="named-paragraph-number">6.1</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><a href="2-ea.html#SP4" class="function-link"><span class="function-syntax">EmitArrays::iname_entry</span></a><span class="plain-syntax">(</span><a href="2-hrr.html#SP11" class="function-link"><span class="function-syntax">Hierarchy::find</span></a><span class="plain-syntax">(</span><span class="constant-syntax">VERB_DIRECTIVE_DIVIDER_HL</span><span class="plain-syntax">));</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="7-cgl.html#SP6">&#167;6</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP6_2" class="paragraph-anchor"></a><b>&#167;6.2. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Compile CG_IS_VALUE line-starting material</span><span class="named-paragraph-number">6.2</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">kit</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">GV_IS_VALUE_instance_mode</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><a href="2-ec.html#SP14" class="function-link"><span class="function-syntax">EmitCode::inv</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">IF_BIP</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::down</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">            </span><a href="2-ec.html#SP14" class="function-link"><span class="function-syntax">EmitCode::inv</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">EQ_BIP</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::down</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">                </span><a href="2-ec.html#SP8" class="function-link"><span class="function-syntax">EmitCode::val_symbol</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">K_value</span><span class="plain-syntax">, </span><span class="identifier-syntax">kit</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">instance_s</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">CompileValues::to_code_val</span><span class="plain-syntax">(</span><span class="identifier-syntax">cgl</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">cgl_type</span><span class="plain-syntax">.</span><span class="identifier-syntax">term</span><span class="plain-syntax">[0].</span><span class="identifier-syntax">what</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::up</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">            </span><a href="2-ec.html#SP5" class="function-link"><span class="function-syntax">EmitCode::code</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">            </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::down</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">    }</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="7-cgl.html#SP6">&#167;6</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP6_3" class="paragraph-anchor"></a><b>&#167;6.3. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Find the token range</span><span class="named-paragraph-number">6.3</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="identifier-syntax">cg_token</span><span class="plain-syntax"> *</span><span class="identifier-syntax">token</span><span class="plain-syntax"> = </span><span class="identifier-syntax">cgl</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">tokens</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">genuinely_verbal</span><span class="plain-syntax">) &amp;&amp; (</span><span class="identifier-syntax">token</span><span class="plain-syntax">)) </span><span class="identifier-syntax">token</span><span class="plain-syntax"> = </span><span class="identifier-syntax">token</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">next_token</span><span class="plain-syntax">; </span><span class="comment-syntax"> skip command word</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">token_from</span><span class="plain-syntax"> = </span><span class="identifier-syntax">token</span><span class="plain-syntax">; </span><span class="identifier-syntax">token_to</span><span class="plain-syntax"> = </span><span class="identifier-syntax">token</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (; </span><span class="identifier-syntax">token</span><span class="plain-syntax">; </span><span class="identifier-syntax">token</span><span class="plain-syntax"> = </span><span class="identifier-syntax">token</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">next_token</span><span class="plain-syntax">) </span><span class="identifier-syntax">token_to</span><span class="plain-syntax"> = </span><span class="identifier-syntax">token</span><span class="plain-syntax">;</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="7-cgl.html#SP6">&#167;6</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP6_4" class="paragraph-anchor"></a><b>&#167;6.4. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Compile CG_IS_COMMAND line-ending material</span><span class="named-paragraph-number">6.4</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><a href="7-cgl.html#SP8" class="function-link"><span class="function-syntax">RTCommandGrammarLines::cgl_compile_result_of_mistake</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">kit</span><span class="plain-syntax">, </span><span class="identifier-syntax">cgl</span><span class="plain-syntax">) == </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><a href="2-ea.html#SP4" class="function-link"><span class="function-syntax">EmitArrays::iname_entry</span></a><span class="plain-syntax">(</span><a href="2-hrr.html#SP11" class="function-link"><span class="function-syntax">Hierarchy::find</span></a><span class="plain-syntax">(</span><span class="constant-syntax">VERB_DIRECTIVE_RESULT_HL</span><span class="plain-syntax">));</span>
<span class="plain-syntax">        </span><a href="2-ea.html#SP4" class="function-link"><span class="function-syntax">EmitArrays::iname_entry</span></a><span class="plain-syntax">(</span><a href="5-act2.html#SP6" class="function-link"><span class="function-syntax">RTActions::double_sharp</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">cgl</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">resulting_action</span><span class="plain-syntax">));</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">cgl</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">reversed</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><a href="2-ea.html#SP4" class="function-link"><span class="function-syntax">EmitArrays::iname_entry</span></a><span class="plain-syntax">(</span><a href="2-hrr.html#SP11" class="function-link"><span class="function-syntax">Hierarchy::find</span></a><span class="plain-syntax">(</span><span class="constant-syntax">VERB_DIRECTIVE_REVERSE_HL</span><span class="plain-syntax">));</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">    }</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="7-cgl.html#SP6">&#167;6</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP6_5" class="paragraph-anchor"></a><b>&#167;6.5. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Compile CG_IS_PROPERTY_NAME or CG_IS_TOKEN line-ending material</span><span class="named-paragraph-number">6.5</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><a href="2-ec.html#SP14" class="function-link"><span class="function-syntax">EmitCode::inv</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">RETURN_BIP</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::down</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">        </span><a href="2-ec.html#SP8" class="function-link"><span class="function-syntax">EmitCode::val_symbol</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">K_value</span><span class="plain-syntax">, </span><span class="identifier-syntax">kit</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">rv_s</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::up</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">    </span><a href="2-ec.html#SP17" class="function-link"><span class="function-syntax">EmitCode::place_label</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">kit</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">fail_label</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="2-ec.html#SP14" class="function-link"><span class="function-syntax">EmitCode::inv</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">STORE_BIP</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::down</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">        </span><a href="2-ec.html#SP13" class="function-link"><span class="function-syntax">EmitCode::ref_symbol</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">K_value</span><span class="plain-syntax">, </span><span class="identifier-syntax">kit</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">rv_s</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><a href="2-ec.html#SP8" class="function-link"><span class="function-syntax">EmitCode::val_iname</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">K_value</span><span class="plain-syntax">, </span><a href="2-hrr.html#SP11" class="function-link"><span class="function-syntax">Hierarchy::find</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">GPR_PREPOSITION_HL</span><span class="plain-syntax">));</span>
<span class="plain-syntax">    </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::up</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">    </span><a href="2-ec.html#SP14" class="function-link"><span class="function-syntax">EmitCode::inv</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">STORE_BIP</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::down</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">        </span><a href="2-ec.html#SP13" class="function-link"><span class="function-syntax">EmitCode::ref_iname</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">K_value</span><span class="plain-syntax">, </span><a href="2-hrr.html#SP11" class="function-link"><span class="function-syntax">Hierarchy::find</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">WN_HL</span><span class="plain-syntax">));</span>
<span class="plain-syntax">        </span><a href="2-ec.html#SP8" class="function-link"><span class="function-syntax">EmitCode::val_symbol</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">K_value</span><span class="plain-syntax">, </span><span class="identifier-syntax">kit</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">original_wn_s</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::up</span></a><span class="plain-syntax">();</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="7-cgl.html#SP6">&#167;6</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP6_6" class="paragraph-anchor"></a><b>&#167;6.6. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Compile CG_IS_CONSULT line-ending material</span><span class="named-paragraph-number">6.6</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><a href="2-ec.html#SP14" class="function-link"><span class="function-syntax">EmitCode::inv</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">IF_BIP</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::down</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">        </span><a href="2-ec.html#SP14" class="function-link"><span class="function-syntax">EmitCode::inv</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">OR_BIP</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::down</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">            </span><a href="2-ec.html#SP14" class="function-link"><span class="function-syntax">EmitCode::inv</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">EQ_BIP</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::down</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">                </span><a href="2-ec.html#SP8" class="function-link"><span class="function-syntax">EmitCode::val_symbol</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">K_value</span><span class="plain-syntax">, </span><span class="identifier-syntax">kit</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">range_words_s</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                </span><a href="2-ec.html#SP8" class="function-link"><span class="function-syntax">EmitCode::val_number</span></a><span class="plain-syntax">(0);</span>
<span class="plain-syntax">            </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::up</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">            </span><a href="2-ec.html#SP14" class="function-link"><span class="function-syntax">EmitCode::inv</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">EQ_BIP</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::down</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">                </span><a href="2-ec.html#SP14" class="function-link"><span class="function-syntax">EmitCode::inv</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">MINUS_BIP</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::down</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">                    </span><a href="2-ec.html#SP8" class="function-link"><span class="function-syntax">EmitCode::val_iname</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">K_value</span><span class="plain-syntax">, </span><a href="2-hrr.html#SP11" class="function-link"><span class="function-syntax">Hierarchy::find</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">WN_HL</span><span class="plain-syntax">));</span>
<span class="plain-syntax">                    </span><a href="2-ec.html#SP8" class="function-link"><span class="function-syntax">EmitCode::val_symbol</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">K_value</span><span class="plain-syntax">, </span><span class="identifier-syntax">kit</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">range_from_s</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::up</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">                </span><a href="2-ec.html#SP8" class="function-link"><span class="function-syntax">EmitCode::val_symbol</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">K_value</span><span class="plain-syntax">, </span><span class="identifier-syntax">kit</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">range_words_s</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::up</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">        </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::up</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">        </span><a href="2-ec.html#SP5" class="function-link"><span class="function-syntax">EmitCode::code</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">        </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::down</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">            </span><a href="2-ec.html#SP14" class="function-link"><span class="function-syntax">EmitCode::inv</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">RETURN_BIP</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::down</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">                </span><a href="2-ec.html#SP8" class="function-link"><span class="function-syntax">EmitCode::val_symbol</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">K_value</span><span class="plain-syntax">, </span><span class="identifier-syntax">kit</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">rv_s</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::up</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">        </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::up</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">    </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::up</span></a><span class="plain-syntax">();</span>

<span class="plain-syntax">    </span><a href="2-ec.html#SP17" class="function-link"><span class="function-syntax">EmitCode::place_label</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">kit</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">fail_label</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="2-ec.html#SP14" class="function-link"><span class="function-syntax">EmitCode::inv</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">STORE_BIP</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::down</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">        </span><a href="2-ec.html#SP13" class="function-link"><span class="function-syntax">EmitCode::ref_symbol</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">K_value</span><span class="plain-syntax">, </span><span class="identifier-syntax">kit</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">rv_s</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><a href="2-ec.html#SP8" class="function-link"><span class="function-syntax">EmitCode::val_iname</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">K_value</span><span class="plain-syntax">, </span><a href="2-hrr.html#SP11" class="function-link"><span class="function-syntax">Hierarchy::find</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">GPR_PREPOSITION_HL</span><span class="plain-syntax">));</span>
<span class="plain-syntax">    </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::up</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">    </span><a href="2-ec.html#SP14" class="function-link"><span class="function-syntax">EmitCode::inv</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">STORE_BIP</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::down</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">        </span><a href="2-ec.html#SP13" class="function-link"><span class="function-syntax">EmitCode::ref_iname</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">K_value</span><span class="plain-syntax">, </span><a href="2-hrr.html#SP11" class="function-link"><span class="function-syntax">Hierarchy::find</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">WN_HL</span><span class="plain-syntax">));</span>
<span class="plain-syntax">        </span><a href="2-ec.html#SP8" class="function-link"><span class="function-syntax">EmitCode::val_symbol</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">K_value</span><span class="plain-syntax">, </span><span class="identifier-syntax">kit</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">original_wn_s</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::up</span></a><span class="plain-syntax">();</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="7-cgl.html#SP6">&#167;6</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP6_7" class="paragraph-anchor"></a><b>&#167;6.7. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Compile CG_IS_SUBJECT line-ending material</span><span class="named-paragraph-number">6.7</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><a href="7-pnp.html#SP5" class="function-link"><span class="function-syntax">ParseName::compile_reset_code_after_failed_line</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">kit</span><span class="plain-syntax">, </span><span class="identifier-syntax">cgl</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">pluralised</span><span class="plain-syntax">);</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="7-cgl.html#SP6">&#167;6</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP6_8" class="paragraph-anchor"></a><b>&#167;6.8. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Compile CG_IS_VALUE line-ending material</span><span class="named-paragraph-number">6.8</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><a href="2-ec.html#SP14" class="function-link"><span class="function-syntax">EmitCode::inv</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">STORE_BIP</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::down</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">        </span><a href="2-ec.html#SP13" class="function-link"><span class="function-syntax">EmitCode::ref_iname</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">K_value</span><span class="plain-syntax">, </span><a href="2-hrr.html#SP11" class="function-link"><span class="function-syntax">Hierarchy::find</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">PARSED_NUMBER_HL</span><span class="plain-syntax">));</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">CompileValues::to_code_val</span><span class="plain-syntax">(</span><span class="identifier-syntax">cgl</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">cgl_type</span><span class="plain-syntax">.</span><span class="identifier-syntax">term</span><span class="plain-syntax">[0].</span><span class="identifier-syntax">what</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::up</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">    </span><a href="2-ec.html#SP14" class="function-link"><span class="function-syntax">EmitCode::inv</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">RETURN_BIP</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::down</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">        </span><a href="2-ec.html#SP8" class="function-link"><span class="function-syntax">EmitCode::val_iname</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">K_object</span><span class="plain-syntax">, </span><a href="2-hrr.html#SP11" class="function-link"><span class="function-syntax">Hierarchy::find</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">GPR_NUMBER_HL</span><span class="plain-syntax">));</span>
<span class="plain-syntax">    </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::up</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">    </span><a href="2-ec.html#SP17" class="function-link"><span class="function-syntax">EmitCode::place_label</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">kit</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">fail_label</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="2-ec.html#SP14" class="function-link"><span class="function-syntax">EmitCode::inv</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">STORE_BIP</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::down</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">        </span><a href="2-ec.html#SP13" class="function-link"><span class="function-syntax">EmitCode::ref_iname</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">K_value</span><span class="plain-syntax">, </span><a href="2-hrr.html#SP11" class="function-link"><span class="function-syntax">Hierarchy::find</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">WN_HL</span><span class="plain-syntax">));</span>
<span class="plain-syntax">        </span><a href="2-ec.html#SP8" class="function-link"><span class="function-syntax">EmitCode::val_symbol</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">K_value</span><span class="plain-syntax">, </span><span class="identifier-syntax">kit</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">original_wn_s</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::up</span></a><span class="plain-syntax">();</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">kit</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">GV_IS_VALUE_instance_mode</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::up</span></a><span class="plain-syntax">(); </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::up</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">    }</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="7-cgl.html#SP6">&#167;6</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP7" class="paragraph-anchor"></a><b>&#167;7. Mistaken grammar lines.</b>"Mistaken" lines are command which can be matched, but only in order to
print nicely worded rejections. A number of implementations were tried for
this, for instance producing parser errors and setting <span class="extract"><span class="extract-syntax">pe</span></span> to some high
value, but the method now used is for a mistaken line to produce a successful
parse but result in the (fake) action <span class="extract"><span class="extract-syntax">##MistakeAction</span></span>. The hard part is to
send information to the processing function for that action, <span class="extract"><span class="extract-syntax">MistakeActionSub</span></span>,
indicating what the mistake was, exactly. We do this by beginning the line
with an additional token matching the empty text (and thus, always matching)
but with the side-effect of setting a special global variable. Thus a mistaken
line <span class="extract"><span class="extract-syntax">act [thing]</span></span> comes out as something like:
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">* </span><span class="identifier-syntax">Mistake_Token_12</span><span class="plain-syntax"> </span><span class="character-syntax">'act'</span><span class="plain-syntax"> </span><span class="identifier-syntax">noun</span><span class="plain-syntax"> -&gt; </span><span class="identifier-syntax">MistakeAction</span>
</pre>
<p class="commentary">Since the command parser accepts the first command which matches, and since
none of this can be recursive, the value of this variable at the end of
command parsing is guaranteed to be the one set during the line causing the
mistake.
</p>

<p class="commentary">The following compiles a simple GPR to perform this "match":
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">RTCommandGrammarLines::cgl_compile_extra_token_for_mistake</span><button class="popup" onclick="togglePopup('usagePopup6')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup6">Usage of <span class="code-font"><span class="function-syntax">RTCommandGrammarLines::cgl_compile_extra_token_for_mistake</span></span>:<br/><a href="7-cgl.html#SP6">&#167;6</a></span></button><span class="plain-syntax">(</span><span class="identifier-syntax">cg_line</span><span class="plain-syntax"> *</span><span class="identifier-syntax">cgl</span><span class="plain-syntax">, </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">cg_is</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><a href="2-ea.html#SP4" class="function-link"><span class="function-syntax">EmitArrays::iname_entry</span></a><span class="plain-syntax">(</span><a href="7-cgl.html#SP3" class="function-link"><span class="function-syntax">RTCommandGrammarLines::get_mistake_iname</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">cgl</span><span class="plain-syntax">));</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="identifier-syntax">desc</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Str::new</span><span class="plain-syntax">();</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">WRITE_TO</span><span class="plain-syntax">(</span><span class="identifier-syntax">desc</span><span class="plain-syntax">, </span><span class="string-syntax">"mistake token %d"</span><span class="plain-syntax">, </span><span class="constant-syntax">100</span><span class="plain-syntax"> + </span><span class="identifier-syntax">cgl</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">allocation_id</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">Sequence::queue</span><span class="plain-syntax">(&amp;</span><a href="7-cgl.html#SP7" class="function-link"><span class="function-syntax">RTCommandGrammarLines::mistake_agent</span></a><span class="plain-syntax">, </span><span class="identifier-syntax">STORE_POINTER_cg_line</span><span class="plain-syntax">(</span><span class="identifier-syntax">cgl</span><span class="plain-syntax">), </span><span class="identifier-syntax">desc</span><span class="plain-syntax">);</span>
<span class="plain-syntax">}</span>
<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">RTCommandGrammarLines::mistake_agent</span><span class="plain-syntax">(</span><span class="identifier-syntax">compilation_subtask</span><span class="plain-syntax"> *</span><span class="identifier-syntax">t</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">cg_line</span><span class="plain-syntax"> *</span><span class="identifier-syntax">cgl</span><span class="plain-syntax"> = </span><span class="identifier-syntax">RETRIEVE_POINTER_cg_line</span><span class="plain-syntax">(</span><span class="identifier-syntax">t</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">data</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">packaging_state</span><span class="plain-syntax"> </span><span class="identifier-syntax">save</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Functions::begin</span><span class="plain-syntax">(</span><a href="7-cgl.html#SP3" class="function-link"><span class="function-syntax">RTCommandGrammarLines::get_mistake_iname</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">cgl</span><span class="plain-syntax">));</span>

<span class="plain-syntax">    </span><a href="2-ec.html#SP14" class="function-link"><span class="function-syntax">EmitCode::inv</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">IF_BIP</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::down</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">        </span><a href="2-ec.html#SP14" class="function-link"><span class="function-syntax">EmitCode::inv</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">NE_BIP</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::down</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">            </span><a href="2-ec.html#SP8" class="function-link"><span class="function-syntax">EmitCode::val_iname</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">K_object</span><span class="plain-syntax">, </span><a href="2-hrr.html#SP11" class="function-link"><span class="function-syntax">Hierarchy::find</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">ACTOR_HL</span><span class="plain-syntax">));</span>
<span class="plain-syntax">            </span><a href="2-ec.html#SP8" class="function-link"><span class="function-syntax">EmitCode::val_iname</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">K_object</span><span class="plain-syntax">, </span><a href="2-hrr.html#SP11" class="function-link"><span class="function-syntax">Hierarchy::find</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">PLAYER_HL</span><span class="plain-syntax">));</span>
<span class="plain-syntax">        </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::up</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">        </span><a href="2-ec.html#SP5" class="function-link"><span class="function-syntax">EmitCode::code</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">        </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::down</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">            </span><a href="2-ec.html#SP14" class="function-link"><span class="function-syntax">EmitCode::inv</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">RETURN_BIP</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::down</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">                </span><a href="2-ec.html#SP8" class="function-link"><span class="function-syntax">EmitCode::val_iname</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">K_value</span><span class="plain-syntax">, </span><a href="2-hrr.html#SP11" class="function-link"><span class="function-syntax">Hierarchy::find</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">GPR_FAIL_HL</span><span class="plain-syntax">));</span>
<span class="plain-syntax">            </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::up</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">        </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::up</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">    </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::up</span></a><span class="plain-syntax">();</span>

<span class="plain-syntax">    </span><a href="2-ec.html#SP14" class="function-link"><span class="function-syntax">EmitCode::inv</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">STORE_BIP</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::down</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">        </span><a href="2-ec.html#SP13" class="function-link"><span class="function-syntax">EmitCode::ref_iname</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">K_number</span><span class="plain-syntax">, </span><a href="2-hrr.html#SP11" class="function-link"><span class="function-syntax">Hierarchy::find</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">UNDERSTAND_AS_MISTAKE_NUMBER_HL</span><span class="plain-syntax">));</span>
<span class="plain-syntax">        </span><a href="2-ec.html#SP8" class="function-link"><span class="function-syntax">EmitCode::val_number</span></a><span class="plain-syntax">((</span><span class="identifier-syntax">inter_ti</span><span class="plain-syntax">) (100 + </span><span class="identifier-syntax">cgl</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">allocation_id</span><span class="plain-syntax">));</span>
<span class="plain-syntax">    </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::up</span></a><span class="plain-syntax">();</span>

<span class="plain-syntax">    </span><a href="2-ec.html#SP14" class="function-link"><span class="function-syntax">EmitCode::inv</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">RETURN_BIP</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::down</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">        </span><a href="2-ec.html#SP8" class="function-link"><span class="function-syntax">EmitCode::val_iname</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">K_value</span><span class="plain-syntax">, </span><a href="2-hrr.html#SP11" class="function-link"><span class="function-syntax">Hierarchy::find</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">GPR_PREPOSITION_HL</span><span class="plain-syntax">));</span>
<span class="plain-syntax">    </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::up</span></a><span class="plain-syntax">();</span>

<span class="plain-syntax">    </span><span class="identifier-syntax">Functions::end</span><span class="plain-syntax">(</span><span class="identifier-syntax">save</span><span class="plain-syntax">);</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP8" class="paragraph-anchor"></a><b>&#167;8. </b>At the far end of the grammar line, we also have to give the nonstandard
result, the "MistakeAction".
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="function-syntax">RTCommandGrammarLines::cgl_compile_result_of_mistake</span><button class="popup" onclick="togglePopup('usagePopup7')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup7">Usage of <span class="code-font"><span class="function-syntax">RTCommandGrammarLines::cgl_compile_result_of_mistake</span></span>:<br/><a href="7-cgl.html#SP6_4">&#167;6.4</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">gpr_kit</span><span class="plain-syntax"> *</span><span class="identifier-syntax">kit</span><span class="plain-syntax">, </span><span class="identifier-syntax">cg_line</span><span class="plain-syntax"> *</span><span class="identifier-syntax">cgl</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">cgl</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">mistaken</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><a href="2-ea.html#SP4" class="function-link"><span class="function-syntax">EmitArrays::iname_entry</span></a><span class="plain-syntax">(</span><a href="2-hrr.html#SP11" class="function-link"><span class="function-syntax">Hierarchy::find</span></a><span class="plain-syntax">(</span><span class="constant-syntax">VERB_DIRECTIVE_RESULT_HL</span><span class="plain-syntax">));</span>
<span class="plain-syntax">        </span><a href="2-ea.html#SP4" class="function-link"><span class="function-syntax">EmitArrays::iname_entry</span></a><span class="plain-syntax">(</span><a href="2-hrr.html#SP11" class="function-link"><span class="function-syntax">Hierarchy::find</span></a><span class="plain-syntax">(</span><span class="constant-syntax">MISTAKEACTION_HL</span><span class="plain-syntax">));</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP9" class="paragraph-anchor"></a><b>&#167;9. </b>Because <a href="../CommandParserKit/index.html" class="internal">CommandParserKit</a> needs to be able to discuss <span class="extract"><span class="extract-syntax">MistakeAction</span></span>,
we need to compile this constant even if there are, in fact, no mistaken
grammar lines; and since this is a fake action, it needs a <span class="extract"><span class="extract-syntax">MistakeActionSub</span></span>
function to process it.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">RTCommandGrammarLines::MistakeActionSub</span><span class="plain-syntax">(</span><span class="reserved-syntax">void</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">inter_name</span><span class="plain-syntax"> *</span><span class="identifier-syntax">iname</span><span class="plain-syntax"> = </span><a href="2-hrr.html#SP11" class="function-link"><span class="function-syntax">Hierarchy::find</span></a><span class="plain-syntax">(</span><span class="constant-syntax">MISTAKEACTIONSUB_HL</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">packaging_state</span><span class="plain-syntax"> </span><span class="identifier-syntax">save</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Functions::begin</span><span class="plain-syntax">(</span><span class="identifier-syntax">iname</span><span class="plain-syntax">);</span>

<span class="plain-syntax">    </span><a href="2-ec.html#SP14" class="function-link"><span class="function-syntax">EmitCode::inv</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">SWITCH_BIP</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::down</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">        </span><a href="2-ec.html#SP8" class="function-link"><span class="function-syntax">EmitCode::val_iname</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">K_value</span><span class="plain-syntax">, </span><a href="2-hrr.html#SP11" class="function-link"><span class="function-syntax">Hierarchy::find</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">UNDERSTAND_AS_MISTAKE_NUMBER_HL</span><span class="plain-syntax">));</span>
<span class="plain-syntax">        </span><a href="2-ec.html#SP5" class="function-link"><span class="function-syntax">EmitCode::code</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">        </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::down</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">cg_line</span><span class="plain-syntax"> *</span><span class="identifier-syntax">cgl</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">LOOP_OVER</span><span class="plain-syntax">(</span><span class="identifier-syntax">cgl</span><span class="plain-syntax">, </span><span class="identifier-syntax">cg_line</span><span class="plain-syntax">)</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">cgl</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">mistaken</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">                    </span><span class="identifier-syntax">current_sentence</span><span class="plain-syntax"> = </span><span class="identifier-syntax">cgl</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">where_grammar_specified</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                    </span><span class="identifier-syntax">parse_node</span><span class="plain-syntax"> *</span><span class="identifier-syntax">spec</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Wordings::empty</span><span class="plain-syntax">(</span><span class="identifier-syntax">cgl</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">mistake_response_text</span><span class="plain-syntax">))</span>
<span class="plain-syntax">                        </span><span class="identifier-syntax">spec</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Specifications::new_UNKNOWN</span><span class="plain-syntax">(</span><span class="identifier-syntax">cgl</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">mistake_response_text</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                    </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="function-syntax">&lt;s-value&gt;(cgl-&gt;</span><span class="identifier-syntax">mistake_response_text</span><span class="plain-syntax">)) </span><span class="identifier-syntax">spec</span><span class="plain-syntax"> = </span><span class="function-syntax">&lt;&lt;rp&gt;&gt;</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                    </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="identifier-syntax">spec</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Specifications::new_UNKNOWN</span><span class="plain-syntax">(</span><span class="identifier-syntax">cgl</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">mistake_response_text</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                    </span><a href="2-ec.html#SP14" class="function-link"><span class="function-syntax">EmitCode::inv</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">CASE_BIP</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                    </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::down</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">                        </span><a href="2-ec.html#SP8" class="function-link"><span class="function-syntax">EmitCode::val_number</span></a><span class="plain-syntax">((</span><span class="identifier-syntax">inter_ti</span><span class="plain-syntax">) (100+</span><span class="identifier-syntax">cgl</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">allocation_id</span><span class="plain-syntax">));</span>
<span class="plain-syntax">                        </span><a href="2-ec.html#SP5" class="function-link"><span class="function-syntax">EmitCode::code</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">                        </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::down</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">                            </span><a href="2-ec.html#SP14" class="function-link"><span class="function-syntax">EmitCode::call</span></a><span class="plain-syntax">(</span><a href="2-hrr.html#SP11" class="function-link"><span class="function-syntax">Hierarchy::find</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">PARSERERROR_HL</span><span class="plain-syntax">));</span>
<span class="plain-syntax">                            </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::down</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">                                </span><span class="identifier-syntax">CompileValues::to_code_val_of_kind</span><span class="plain-syntax">(</span><span class="identifier-syntax">spec</span><span class="plain-syntax">, </span><span class="identifier-syntax">K_text</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                            </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::up</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">                        </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::up</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">                    </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::up</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">                }</span>

<span class="plain-syntax">            </span><a href="2-ec.html#SP14" class="function-link"><span class="function-syntax">EmitCode::inv</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">DEFAULT_BIP</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::down</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">                </span><a href="2-ec.html#SP5" class="function-link"><span class="function-syntax">EmitCode::code</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">                </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::down</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">                    </span><a href="2-ec.html#SP14" class="function-link"><span class="function-syntax">EmitCode::inv</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">PRINT_BIP</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                    </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::down</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">                        </span><a href="2-ec.html#SP8" class="function-link"><span class="function-syntax">EmitCode::val_text</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">I</span><span class="string-syntax">"I didn't understand that sentence.\n"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                    </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::up</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">                    </span><a href="2-ec.html#SP15" class="function-link"><span class="function-syntax">EmitCode::rtrue</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">                </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::up</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">            </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::up</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">        </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::up</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">    </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::up</span></a><span class="plain-syntax">();</span>

<span class="plain-syntax">    </span><a href="2-ec.html#SP14" class="function-link"><span class="function-syntax">EmitCode::inv</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">STORE_BIP</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::down</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">        </span><a href="2-ec.html#SP13" class="function-link"><span class="function-syntax">EmitCode::ref_iname</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">K_number</span><span class="plain-syntax">, </span><a href="2-hrr.html#SP11" class="function-link"><span class="function-syntax">Hierarchy::find</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">SAY__P_HL</span><span class="plain-syntax">));</span>
<span class="plain-syntax">        </span><a href="2-ec.html#SP8" class="function-link"><span class="function-syntax">EmitCode::val_number</span></a><span class="plain-syntax">(1);</span>
<span class="plain-syntax">    </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::up</span></a><span class="plain-syntax">();</span>

<span class="plain-syntax">    </span><span class="identifier-syntax">Functions::end</span><span class="plain-syntax">(</span><span class="identifier-syntax">save</span><span class="plain-syntax">);</span>

<span class="plain-syntax">    </span><span class="identifier-syntax">inter_name</span><span class="plain-syntax"> *</span><span class="identifier-syntax">ma_iname</span><span class="plain-syntax"> = </span><a href="2-hrr.html#SP11" class="function-link"><span class="function-syntax">Hierarchy::find</span></a><span class="plain-syntax">(</span><span class="constant-syntax">MISTAKEACTION_HL</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="2-emt.html#SP6" class="function-link"><span class="function-syntax">Emit::unchecked_numeric_constant</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">ma_iname</span><span class="plain-syntax">, </span><span class="constant-syntax">10000</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="2-hrr.html#SP17" class="function-link"><span class="function-syntax">Hierarchy::make_available</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">ma_iname</span><span class="plain-syntax">);</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP10" class="paragraph-anchor"></a><b>&#167;10. Conditional grammar lines.</b>Conditional lines are those which match only if some condition holds, and that
can be any condition expressed in Inform 7 source text.
</p>

<p class="commentary">Once again we do this by means of an additional token at the start of the line,
which matches no text, but which matches successfully only if the condition holds.
Note that the remaining tokens in the line are therefore not even looked at if
the condition fails; this of course is faster than if the test were placed at
the end.
</p>

<p class="commentary">Unlike the case of mistaken tokens, a conditional token can appear in any grammar,
not only in CG_IS_COMMAND grammar, so (a) we sometimes must compile code and not
just an extra array entry, and (b) we must be careful about the unusual but not
impossible case of the same grammar line being compiled twice, which can happen
because of <span class="extract"><span class="extract-syntax">parse_name</span></span> inheritance with CG_IS_SUBJECT grammars.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">RTCommandGrammarLines::cgl_compile_extra_token_for_condition</span><button class="popup" onclick="togglePopup('usagePopup8')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup8">Usage of <span class="code-font"><span class="function-syntax">RTCommandGrammarLines::cgl_compile_extra_token_for_condition</span></span>:<br/><a href="7-cgl.html#SP6">&#167;6</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">gpr_kit</span><span class="plain-syntax"> *</span><span class="identifier-syntax">kit</span><span class="plain-syntax">, </span><span class="identifier-syntax">cg_line</span><span class="plain-syntax"> *</span><span class="identifier-syntax">cgl</span><span class="plain-syntax">,</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">cg_is</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">cg_is</span><span class="plain-syntax"> == </span><span class="identifier-syntax">CG_IS_COMMAND</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><a href="2-ea.html#SP4" class="function-link"><span class="function-syntax">EmitArrays::iname_entry</span></a><span class="plain-syntax">(</span><a href="7-cgl.html#SP3" class="function-link"><span class="function-syntax">RTCommandGrammarLines::get_cond_token_iname</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">cgl</span><span class="plain-syntax">));</span>
<span class="plain-syntax">    } </span><span class="reserved-syntax">else</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">        </span><a href="2-ec.html#SP14" class="function-link"><span class="function-syntax">EmitCode::inv</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">IF_BIP</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::down</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">            </span><a href="2-ec.html#SP14" class="function-link"><span class="function-syntax">EmitCode::inv</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">EQ_BIP</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::down</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">                </span><a href="2-ec.html#SP14" class="function-link"><span class="function-syntax">EmitCode::call</span></a><span class="plain-syntax">(</span><a href="7-cgl.html#SP3" class="function-link"><span class="function-syntax">RTCommandGrammarLines::get_cond_token_iname</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">cgl</span><span class="plain-syntax">));</span>
<span class="plain-syntax">                </span><a href="2-ec.html#SP8" class="function-link"><span class="function-syntax">EmitCode::val_iname</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">K_value</span><span class="plain-syntax">, </span><a href="2-hrr.html#SP11" class="function-link"><span class="function-syntax">Hierarchy::find</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">GPR_FAIL_HL</span><span class="plain-syntax">));</span>
<span class="plain-syntax">            </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::up</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">            </span><a href="2-ec.html#SP5" class="function-link"><span class="function-syntax">EmitCode::code</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">            </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::down</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">                </span><a href="2-ec.html#SP14" class="function-link"><span class="function-syntax">EmitCode::inv</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">JUMP_BIP</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::down</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">                    </span><a href="2-ec.html#SP17" class="function-link"><span class="function-syntax">EmitCode::lab</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">kit</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">fail_label</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::up</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">            </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::up</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">        </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::up</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">cgl</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">compilation_data</span><span class="plain-syntax">.</span><span class="element-syntax">cond_token_compiled</span><span class="plain-syntax"> == </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">cgl</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">compilation_data</span><span class="plain-syntax">.</span><span class="element-syntax">cond_token_compiled</span><span class="plain-syntax"> = </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="identifier-syntax">desc</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Str::new</span><span class="plain-syntax">();</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">WRITE_TO</span><span class="plain-syntax">(</span><span class="identifier-syntax">desc</span><span class="plain-syntax">, </span><span class="string-syntax">"conditional token %W"</span><span class="plain-syntax">, </span><span class="identifier-syntax">Node::get_text</span><span class="plain-syntax">(</span><span class="identifier-syntax">CGLines::get_understand_cond</span><span class="plain-syntax">(</span><span class="identifier-syntax">cgl</span><span class="plain-syntax">)));</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">Sequence::queue</span><span class="plain-syntax">(&amp;</span><a href="7-cgl.html#SP11" class="function-link"><span class="function-syntax">RTCommandGrammarLines::cond_agent</span></a><span class="plain-syntax">, </span><span class="identifier-syntax">STORE_POINTER_cg_line</span><span class="plain-syntax">(</span><span class="identifier-syntax">cgl</span><span class="plain-syntax">), </span><span class="identifier-syntax">desc</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP11" class="paragraph-anchor"></a><b>&#167;11. </b>So, then, the code above ensures that this GPR function is compiled exactly
once per conditional grammar line:
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">RTCommandGrammarLines::cond_agent</span><button class="popup" onclick="togglePopup('usagePopup9')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup9">Usage of <span class="code-font"><span class="function-syntax">RTCommandGrammarLines::cond_agent</span></span>:<br/><a href="7-cgl.html#SP10">&#167;10</a></span></button><span class="plain-syntax">(</span><span class="identifier-syntax">compilation_subtask</span><span class="plain-syntax"> *</span><span class="identifier-syntax">t</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">cg_line</span><span class="plain-syntax"> *</span><span class="identifier-syntax">cgl</span><span class="plain-syntax"> = </span><span class="identifier-syntax">RETRIEVE_POINTER_cg_line</span><span class="plain-syntax">(</span><span class="identifier-syntax">t</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">data</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">current_sentence</span><span class="plain-syntax"> = </span><span class="identifier-syntax">cgl</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">where_grammar_specified</span><span class="plain-syntax">;</span>

<span class="plain-syntax">    </span><span class="identifier-syntax">packaging_state</span><span class="plain-syntax"> </span><span class="identifier-syntax">save</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Functions::begin</span><span class="plain-syntax">(</span><a href="7-cgl.html#SP3" class="function-link"><span class="function-syntax">RTCommandGrammarLines::get_cond_token_iname</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">cgl</span><span class="plain-syntax">));</span>

<span class="plain-syntax">    </span><span class="identifier-syntax">parse_node</span><span class="plain-syntax"> *</span><span class="identifier-syntax">spec</span><span class="plain-syntax"> = </span><span class="identifier-syntax">CGLines::get_understand_cond</span><span class="plain-syntax">(</span><span class="identifier-syntax">cgl</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">pcalc_prop</span><span class="plain-syntax"> *</span><span class="identifier-syntax">prop</span><span class="plain-syntax"> = </span><span class="identifier-syntax">cgl</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">understand_when_prop</span><span class="plain-syntax">;</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">spec</span><span class="plain-syntax">) || (</span><span class="identifier-syntax">prop</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">        </span><a href="2-ec.html#SP14" class="function-link"><span class="function-syntax">EmitCode::inv</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">IF_BIP</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::down</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">spec</span><span class="plain-syntax">) &amp;&amp; (</span><span class="identifier-syntax">prop</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">                </span><a href="2-ec.html#SP14" class="function-link"><span class="function-syntax">EmitCode::inv</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">AND_BIP</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::down</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">            }</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">spec</span><span class="plain-syntax">) </span><span class="identifier-syntax">CompileValues::to_code_val_of_kind</span><span class="plain-syntax">(</span><span class="identifier-syntax">spec</span><span class="plain-syntax">, </span><span class="identifier-syntax">K_truth_state</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">prop</span><span class="plain-syntax">) </span><span class="identifier-syntax">CompilePropositions::to_test_as_condition</span><span class="plain-syntax">(</span><span class="identifier-syntax">Rvalues::new_self_object_constant</span><span class="plain-syntax">(), </span><span class="identifier-syntax">prop</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">spec</span><span class="plain-syntax">) &amp;&amp; (</span><span class="identifier-syntax">prop</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">                </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::up</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">            }</span>
<span class="plain-syntax">            </span><a href="2-ec.html#SP5" class="function-link"><span class="function-syntax">EmitCode::code</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">            </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::down</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">                </span><a href="2-ec.html#SP14" class="function-link"><span class="function-syntax">EmitCode::inv</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">RETURN_BIP</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::down</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">                    </span><a href="2-ec.html#SP8" class="function-link"><span class="function-syntax">EmitCode::val_iname</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">K_value</span><span class="plain-syntax">, </span><a href="2-hrr.html#SP11" class="function-link"><span class="function-syntax">Hierarchy::find</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">GPR_PREPOSITION_HL</span><span class="plain-syntax">));</span>
<span class="plain-syntax">                </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::up</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">            </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::up</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">        </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::up</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><a href="2-ec.html#SP14" class="function-link"><span class="function-syntax">EmitCode::inv</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">RETURN_BIP</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::down</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">        </span><a href="2-ec.html#SP8" class="function-link"><span class="function-syntax">EmitCode::val_iname</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">K_value</span><span class="plain-syntax">, </span><a href="2-hrr.html#SP11" class="function-link"><span class="function-syntax">Hierarchy::find</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">GPR_FAIL_HL</span><span class="plain-syntax">));</span>
<span class="plain-syntax">    </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::up</span></a><span class="plain-syntax">();</span>

<span class="plain-syntax">    </span><span class="identifier-syntax">Functions::end</span><span class="plain-syntax">(</span><span class="identifier-syntax">save</span><span class="plain-syntax">);</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP12" class="paragraph-anchor"></a><b>&#167;12. Slash GPRs.</b>These are functions which match exactly one of the tokens in the given range;
so, for example, <span class="extract"><span class="extract-syntax">fish/fowl/duck/drake</span></span> could be handled by a slash GPR.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">typedef</span><span class="plain-syntax"> </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="reserved-syntax">slash_gpr</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="identifier-syntax">cg_token</span><span class="plain-syntax"> *</span><span class="identifier-syntax">first_choice</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="identifier-syntax">cg_token</span><span class="plain-syntax"> *</span><span class="identifier-syntax">last_choice</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="identifier-syntax">inter_name</span><span class="plain-syntax"> *</span><span class="identifier-syntax">sgpr_iname</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">CLASS_DEFINITION</span>
<span class="plain-syntax">} </span><span class="reserved-syntax">slash_gpr</span><span class="plain-syntax">;</span>
</pre>
<ul class="endnotetexts"><li>The structure slash_gpr is private to this section.</li></ul>
<p class="commentary firstcommentary"><a id="SP13" class="paragraph-anchor"></a><b>&#167;13. </b></p>

<pre class="displayed-code all-displayed-code code-font">
<span class="identifier-syntax">inter_name</span><span class="plain-syntax"> *</span><span class="function-syntax">RTCommandGrammarLines::slash</span><button class="popup" onclick="togglePopup('usagePopup10')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup10">Usage of <span class="code-font"><span class="function-syntax">RTCommandGrammarLines::slash</span></span>:<br/><a href="7-cgl.html#SP14_4">&#167;14.4</a></span></button><span class="plain-syntax">(</span><span class="identifier-syntax">cg_token</span><span class="plain-syntax"> *</span><span class="identifier-syntax">from_token</span><span class="plain-syntax">, </span><span class="identifier-syntax">cg_token</span><span class="plain-syntax"> *</span><span class="identifier-syntax">to_token</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">slash_gpr</span><span class="plain-syntax"> *</span><span class="identifier-syntax">sgpr</span><span class="plain-syntax"> = </span><span class="identifier-syntax">CREATE</span><span class="plain-syntax">(</span><span class="reserved-syntax">slash_gpr</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">sgpr</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">first_choice</span><span class="plain-syntax"> = </span><span class="identifier-syntax">from_token</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">sgpr</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">last_choice</span><span class="plain-syntax"> = </span><span class="identifier-syntax">to_token</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">package_request</span><span class="plain-syntax"> *</span><span class="identifier-syntax">PR</span><span class="plain-syntax"> = </span><a href="2-hrr.html#SP19" class="function-link"><span class="function-syntax">Hierarchy::local_package</span></a><span class="plain-syntax">(</span><span class="constant-syntax">SLASH_TOKENS_HAP</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">sgpr</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">sgpr_iname</span><span class="plain-syntax"> = </span><a href="2-hrr.html#SP12" class="function-link"><span class="function-syntax">Hierarchy::make_iname_in</span></a><span class="plain-syntax">(</span><span class="constant-syntax">SLASH_FN_HL</span><span class="plain-syntax">, </span><span class="identifier-syntax">PR</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="identifier-syntax">desc</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Str::new</span><span class="plain-syntax">();</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">WRITE_TO</span><span class="plain-syntax">(</span><span class="identifier-syntax">desc</span><span class="plain-syntax">, </span><span class="string-syntax">"slash GPR %d"</span><span class="plain-syntax">, </span><span class="identifier-syntax">sgpr</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">allocation_id</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">Sequence::queue</span><span class="plain-syntax">(&amp;</span><a href="7-cgl.html#SP13" class="function-link"><span class="function-syntax">RTCommandGrammarLines::slash_GPR_agent</span></a><span class="plain-syntax">, </span><span class="identifier-syntax">STORE_POINTER_slash_gpr</span><span class="plain-syntax">(</span><span class="identifier-syntax">sgpr</span><span class="plain-syntax">), </span><span class="identifier-syntax">desc</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">sgpr</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">sgpr_iname</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>

<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">RTCommandGrammarLines::slash_GPR_agent</span><span class="plain-syntax">(</span><span class="identifier-syntax">compilation_subtask</span><span class="plain-syntax"> *</span><span class="identifier-syntax">t</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">slash_gpr</span><span class="plain-syntax"> *</span><span class="identifier-syntax">sgpr</span><span class="plain-syntax"> = </span><span class="identifier-syntax">RETRIEVE_POINTER_slash_gpr</span><span class="plain-syntax">(</span><span class="identifier-syntax">t</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">data</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">packaging_state</span><span class="plain-syntax"> </span><span class="identifier-syntax">save</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Functions::begin</span><span class="plain-syntax">(</span><span class="identifier-syntax">sgpr</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">sgpr_iname</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">gpr_kit</span><span class="plain-syntax"> </span><span class="identifier-syntax">kit</span><span class="plain-syntax"> = </span><a href="2-gpr.html#SP3" class="function-link"><span class="function-syntax">GPRs::new_kit</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">    </span><a href="2-gpr.html#SP4" class="function-link"><span class="function-syntax">GPRs::add_original_var</span></a><span class="plain-syntax">(&amp;</span><span class="identifier-syntax">kit</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="2-gpr.html#SP4" class="function-link"><span class="function-syntax">GPRs::add_standard_vars</span></a><span class="plain-syntax">(&amp;</span><span class="identifier-syntax">kit</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="7-cgl.html#SP14" class="function-link"><span class="function-syntax">RTCommandGrammarLines::compile_token_range</span></a><span class="plain-syntax">(&amp;</span><span class="identifier-syntax">kit</span><span class="plain-syntax">,</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">sgpr</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">first_choice</span><span class="plain-syntax">, </span><span class="identifier-syntax">sgpr</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">last_choice</span><span class="plain-syntax">, </span><span class="identifier-syntax">CG_IS_TOKEN</span><span class="plain-syntax">, </span><span class="identifier-syntax">kit</span><span class="plain-syntax">.</span><span class="element-syntax">group_wn_s</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="2-ec.html#SP14" class="function-link"><span class="function-syntax">EmitCode::inv</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">RETURN_BIP</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::down</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">        </span><a href="2-ec.html#SP8" class="function-link"><span class="function-syntax">EmitCode::val_iname</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">K_value</span><span class="plain-syntax">, </span><a href="2-hrr.html#SP11" class="function-link"><span class="function-syntax">Hierarchy::find</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">GPR_PREPOSITION_HL</span><span class="plain-syntax">));</span>
<span class="plain-syntax">    </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::up</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">Functions::end</span><span class="plain-syntax">(</span><span class="identifier-syntax">save</span><span class="plain-syntax">);</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP14" class="paragraph-anchor"></a><b>&#167;14. Compiling token ranges.</b>This all looks festooned with complexity, but in fact it's almost the same as
looping through the tokens in sequence and calling <a href="7-cgt.html#SP1" class="internal">RTCommandGrammarTokens::compile</a>
on each in turn. The complications come from "slash classes", i.e., the ability
to specify a disjunction like <span class="extract"><span class="extract-syntax">A/B/C/D</span></span>: this looks like a range of 4 tokens.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">RTCommandGrammarLines::compile_token_range</span><button class="popup" onclick="togglePopup('usagePopup11')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup11">Usage of <span class="code-font"><span class="function-syntax">RTCommandGrammarLines::compile_token_range</span></span>:<br/><a href="7-cgl.html#SP6">&#167;6</a>, <a href="7-cgl.html#SP13">&#167;13</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">gpr_kit</span><span class="plain-syntax"> *</span><span class="identifier-syntax">kit</span><span class="plain-syntax">,</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">cg_token</span><span class="plain-syntax"> *</span><span class="identifier-syntax">token_from</span><span class="plain-syntax">, </span><span class="identifier-syntax">cg_token</span><span class="plain-syntax"> *</span><span class="identifier-syntax">token_to</span><span class="plain-syntax">, </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">cg_is</span><span class="plain-syntax">, </span><span class="identifier-syntax">inter_symbol</span><span class="plain-syntax"> *</span><span class="identifier-syntax">group_wn_s</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">code_mode</span><span class="plain-syntax"> = </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">; </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">cg_is</span><span class="plain-syntax"> == </span><span class="identifier-syntax">CG_IS_COMMAND</span><span class="plain-syntax">) </span><span class="identifier-syntax">code_mode</span><span class="plain-syntax"> = </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">slash_equivalence_class</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">alternative_number</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">empty_text_allowed_in_class</span><span class="plain-syntax"> = </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">inter_symbol</span><span class="plain-syntax"> *</span><span class="identifier-syntax">next_reserved_label</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">inter_symbol</span><span class="plain-syntax"> *</span><span class="identifier-syntax">eog_reserved_label</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">LOGIF</span><span class="plain-syntax">(</span><span class="identifier-syntax">GRAMMAR_CONSTRUCTION</span><span class="plain-syntax">, </span><span class="string-syntax">"Compiling token range $c -&gt; $c\n"</span><span class="plain-syntax">, </span><span class="identifier-syntax">token_from</span><span class="plain-syntax">, </span><span class="identifier-syntax">token_to</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">LOG_INDENT</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="identifier-syntax">cg_token</span><span class="plain-syntax"> *</span><span class="identifier-syntax">token</span><span class="plain-syntax"> = </span><span class="identifier-syntax">token_from</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        ((</span><span class="identifier-syntax">token</span><span class="plain-syntax">) &amp;&amp; (</span><span class="identifier-syntax">token</span><span class="plain-syntax"> != </span><span class="identifier-syntax">token_to</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">next_token</span><span class="plain-syntax">));</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">token</span><span class="plain-syntax"> = </span><span class="identifier-syntax">token</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">next_token</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">LOGIF</span><span class="plain-syntax">(</span><span class="identifier-syntax">GRAMMAR_CONSTRUCTION</span><span class="plain-syntax">, </span><span class="string-syntax">"Compiling token $c\n"</span><span class="plain-syntax">, </span><span class="identifier-syntax">token</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">first_token_in_class</span><span class="plain-syntax"> = </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">, </span><span class="identifier-syntax">last_token_in_class</span><span class="plain-syntax"> = </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>

<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">token</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">slash_class</span><span class="plain-syntax"> != </span><span class="constant-syntax">0</span><span class="plain-syntax">) </span><span class="named-paragraph-container code-font"><a href="7-cgl.html#SP14_1" class="named-paragraph-link"><span class="named-paragraph">This token is part of a slashed class</span><span class="named-paragraph-number">14.1</span></a></span>
<span class="plain-syntax">        </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="named-paragraph-container code-font"><a href="7-cgl.html#SP14_2" class="named-paragraph-link"><span class="named-paragraph">This token is not part of a class</span><span class="named-paragraph-number">14.2</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">first_token_in_class</span><span class="plain-syntax">) </span><span class="identifier-syntax">alternative_number</span><span class="plain-syntax"> = </span><span class="constant-syntax">1</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="identifier-syntax">alternative_number</span><span class="plain-syntax">++;</span>

<span class="plain-syntax">        </span><span class="identifier-syntax">inter_symbol</span><span class="plain-syntax"> *</span><span class="identifier-syntax">jump_on_fail</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">kit</span><span class="plain-syntax">) </span><span class="identifier-syntax">jump_on_fail</span><span class="plain-syntax"> = </span><span class="identifier-syntax">kit</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">fail_label</span><span class="plain-syntax">;</span>

<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">slash_equivalence_class</span><span class="plain-syntax"> &gt; </span><span class="constant-syntax">0</span><span class="plain-syntax">) </span><span class="named-paragraph-container code-font"><a href="7-cgl.html#SP14_3" class="named-paragraph-link"><span class="named-paragraph">Pretoken matter within a slash-class</span><span class="named-paragraph-number">14.3</span></a></span><span class="plain-syntax">;</span>

<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">empty_text_allowed_in_class</span><span class="plain-syntax">) &amp;&amp; (</span><span class="identifier-syntax">code_mode</span><span class="plain-syntax"> == </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">            </span><span class="named-paragraph-container code-font"><a href="7-cgl.html#SP14_4" class="named-paragraph-link"><span class="named-paragraph">Absorb the whole slash-class as a GPR</span><span class="named-paragraph-number">14.4</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">        } </span><span class="reserved-syntax">else</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">consult_mode</span><span class="plain-syntax"> = (</span><span class="identifier-syntax">cg_is</span><span class="plain-syntax"> == </span><span class="identifier-syntax">CG_IS_CONSULT</span><span class="plain-syntax">)?</span><span class="identifier-syntax">TRUE:FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">problem_count</span><span class="plain-syntax"> == </span><span class="constant-syntax">0</span><span class="plain-syntax">)</span>
<span class="plain-syntax">                </span><a href="7-cgt.html#SP1" class="function-link"><span class="function-syntax">RTCommandGrammarTokens::compile</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">kit</span><span class="plain-syntax">, </span><span class="identifier-syntax">token</span><span class="plain-syntax">, </span><span class="identifier-syntax">code_mode</span><span class="plain-syntax">,</span>
<span class="plain-syntax">                    </span><span class="identifier-syntax">jump_on_fail</span><span class="plain-syntax">, </span><span class="identifier-syntax">consult_mode</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        }</span>

<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">slash_equivalence_class</span><span class="plain-syntax"> &gt; </span><span class="constant-syntax">0</span><span class="plain-syntax">) </span><span class="named-paragraph-container code-font"><a href="7-cgl.html#SP14_5" class="named-paragraph-link"><span class="named-paragraph">Posttoken matter within a slash-class</span><span class="named-paragraph-number">14.5</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">LOG_OUTDENT</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP14_1" class="paragraph-anchor"></a><b>&#167;14.1. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">This token is part of a slashed class</span><span class="named-paragraph-number">14.1</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="identifier-syntax">first_token_in_class</span><span class="plain-syntax"> = </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">last_token_in_class</span><span class="plain-syntax"> = </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">token</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">next_token</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">) ||</span>
<span class="plain-syntax">        (</span><span class="identifier-syntax">token</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">next_token</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">slash_class</span><span class="plain-syntax"> != </span><span class="identifier-syntax">token</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">slash_class</span><span class="plain-syntax">))</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">last_token_in_class</span><span class="plain-syntax"> = </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">token</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">slash_class</span><span class="plain-syntax"> != </span><span class="identifier-syntax">slash_equivalence_class</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">first_token_in_class</span><span class="plain-syntax"> = </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">empty_text_allowed_in_class</span><span class="plain-syntax"> = </span><span class="identifier-syntax">token</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">slash_dash_dash</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">slash_equivalence_class</span><span class="plain-syntax"> = </span><span class="identifier-syntax">token</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">slash_class</span><span class="plain-syntax">;</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="7-cgl.html#SP14">&#167;14</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP14_2" class="paragraph-anchor"></a><b>&#167;14.2. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">This token is not part of a class</span><span class="named-paragraph-number">14.2</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="identifier-syntax">slash_equivalence_class</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">empty_text_allowed_in_class</span><span class="plain-syntax"> = </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="7-cgl.html#SP14">&#167;14</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP14_3" class="paragraph-anchor"></a><b>&#167;14.3. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Pretoken matter within a slash-class</span><span class="named-paragraph-number">14.3</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">code_mode</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">first_token_in_class</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><a href="2-ec.html#SP14" class="function-link"><span class="function-syntax">EmitCode::inv</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">STORE_BIP</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::down</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">                </span><a href="2-ec.html#SP13" class="function-link"><span class="function-syntax">EmitCode::ref_symbol</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">K_value</span><span class="plain-syntax">, </span><span class="identifier-syntax">kit</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">group_wn_s</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                </span><a href="2-ec.html#SP8" class="function-link"><span class="function-syntax">EmitCode::val_iname</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">K_value</span><span class="plain-syntax">, </span><a href="2-hrr.html#SP11" class="function-link"><span class="function-syntax">Hierarchy::find</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">WN_HL</span><span class="plain-syntax">));</span>
<span class="plain-syntax">            </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::up</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">next_reserved_label</span><span class="plain-syntax">) </span><a href="2-ec.html#SP17" class="function-link"><span class="function-syntax">EmitCode::place_label</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">next_reserved_label</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">TEMPORARY_TEXT</span><span class="plain-syntax">(</span><span class="identifier-syntax">L</span><span class="plain-syntax">)</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">WRITE_TO</span><span class="plain-syntax">(</span><span class="identifier-syntax">L</span><span class="plain-syntax">, </span><span class="string-syntax">".class_%d_%d_%d"</span><span class="plain-syntax">, </span><span class="identifier-syntax">kit</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">current_grammar_block</span><span class="plain-syntax">,</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">slash_equivalence_class</span><span class="plain-syntax">, </span><span class="identifier-syntax">alternative_number</span><span class="plain-syntax">+1);</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">next_reserved_label</span><span class="plain-syntax"> = </span><a href="2-ec.html#SP17" class="function-link"><span class="function-syntax">EmitCode::reserve_label</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">L</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">DISCARD_TEXT</span><span class="plain-syntax">(</span><span class="identifier-syntax">L</span><span class="plain-syntax">)</span>

<span class="plain-syntax">        </span><a href="2-ec.html#SP14" class="function-link"><span class="function-syntax">EmitCode::inv</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">STORE_BIP</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::down</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">            </span><a href="2-ec.html#SP13" class="function-link"><span class="function-syntax">EmitCode::ref_iname</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">K_value</span><span class="plain-syntax">, </span><a href="2-hrr.html#SP11" class="function-link"><span class="function-syntax">Hierarchy::find</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">WN_HL</span><span class="plain-syntax">));</span>
<span class="plain-syntax">            </span><a href="2-ec.html#SP8" class="function-link"><span class="function-syntax">EmitCode::val_symbol</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">K_value</span><span class="plain-syntax">, </span><span class="identifier-syntax">kit</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">group_wn_s</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::up</span></a><span class="plain-syntax">();</span>

<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">last_token_in_class</span><span class="plain-syntax"> == </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">) || (</span><span class="identifier-syntax">empty_text_allowed_in_class</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">jump_on_fail</span><span class="plain-syntax"> = </span><span class="identifier-syntax">next_reserved_label</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">    }</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="7-cgl.html#SP14">&#167;14</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP14_4" class="paragraph-anchor"></a><b>&#167;14.4. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Absorb the whole slash-class as a GPR</span><span class="named-paragraph-number">14.4</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="identifier-syntax">cg_token</span><span class="plain-syntax"> *</span><span class="identifier-syntax">first_choice</span><span class="plain-syntax"> = </span><span class="identifier-syntax">token</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="identifier-syntax">cg_token</span><span class="plain-syntax"> *</span><span class="identifier-syntax">last_choice</span><span class="plain-syntax"> = </span><span class="identifier-syntax">token</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">while</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">token</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">next_token</span><span class="plain-syntax">) &amp;&amp;</span>
<span class="plain-syntax">            (</span><span class="identifier-syntax">token</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">next_token</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">slash_class</span><span class="plain-syntax"> == </span><span class="identifier-syntax">token</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">slash_class</span><span class="plain-syntax">))</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">token</span><span class="plain-syntax"> = </span><span class="identifier-syntax">token</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">next_token</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">last_choice</span><span class="plain-syntax"> = </span><span class="identifier-syntax">token</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">inter_name</span><span class="plain-syntax"> *</span><span class="identifier-syntax">iname</span><span class="plain-syntax"> = </span><a href="7-cgl.html#SP13" class="function-link"><span class="function-syntax">RTCommandGrammarLines::slash</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">first_choice</span><span class="plain-syntax">, </span><span class="identifier-syntax">last_choice</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="2-ea.html#SP4" class="function-link"><span class="function-syntax">EmitArrays::iname_entry</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">iname</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">last_token_in_class</span><span class="plain-syntax"> = </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="7-cgl.html#SP14">&#167;14</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP14_5" class="paragraph-anchor"></a><b>&#167;14.5. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Posttoken matter within a slash-class</span><span class="named-paragraph-number">14.5</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">code_mode</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">last_token_in_class</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">empty_text_allowed_in_class</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">                </span><span class="named-paragraph-container code-font"><a href="7-cgl.html#SP14_5_1" class="named-paragraph-link"><span class="named-paragraph">Jump to end of class</span><span class="named-paragraph-number">14.5.1</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">next_reserved_label</span><span class="plain-syntax">)</span>
<span class="plain-syntax">                    </span><a href="2-ec.html#SP17" class="function-link"><span class="function-syntax">EmitCode::place_label</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">next_reserved_label</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">next_reserved_label</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                </span><a href="2-ec.html#SP14" class="function-link"><span class="function-syntax">EmitCode::inv</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">STORE_BIP</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::down</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">                    </span><a href="2-ec.html#SP13" class="function-link"><span class="function-syntax">EmitCode::ref_iname</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">K_value</span><span class="plain-syntax">, </span><a href="2-hrr.html#SP11" class="function-link"><span class="function-syntax">Hierarchy::find</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">WN_HL</span><span class="plain-syntax">));</span>
<span class="plain-syntax">                    </span><a href="2-ec.html#SP8" class="function-link"><span class="function-syntax">EmitCode::val_symbol</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">K_value</span><span class="plain-syntax">, </span><span class="identifier-syntax">kit</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">group_wn_s</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::up</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">            }</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">eog_reserved_label</span><span class="plain-syntax">) </span><a href="2-ec.html#SP17" class="function-link"><span class="function-syntax">EmitCode::place_label</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">eog_reserved_label</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">eog_reserved_label</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        } </span><span class="reserved-syntax">else</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">            </span><span class="named-paragraph-container code-font"><a href="7-cgl.html#SP14_5_1" class="named-paragraph-link"><span class="named-paragraph">Jump to end of class</span><span class="named-paragraph-number">14.5.1</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">    } </span><span class="reserved-syntax">else</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">last_token_in_class</span><span class="plain-syntax"> == </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">)</span>
<span class="plain-syntax">            </span><a href="2-ea.html#SP4" class="function-link"><span class="function-syntax">EmitArrays::iname_entry</span></a><span class="plain-syntax">(</span><a href="2-hrr.html#SP11" class="function-link"><span class="function-syntax">Hierarchy::find</span></a><span class="plain-syntax">(</span><span class="constant-syntax">VERB_DIRECTIVE_SLASH_HL</span><span class="plain-syntax">));</span>
<span class="plain-syntax">    }</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="7-cgl.html#SP14">&#167;14</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP14_5_1" class="paragraph-anchor"></a><b>&#167;14.5.1. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Jump to end of class</span><span class="named-paragraph-number">14.5.1</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">eog_reserved_label</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">TEMPORARY_TEXT</span><span class="plain-syntax">(</span><span class="identifier-syntax">L</span><span class="plain-syntax">)</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">WRITE_TO</span><span class="plain-syntax">(</span><span class="identifier-syntax">L</span><span class="plain-syntax">, </span><span class="string-syntax">".class_%d_%d_end"</span><span class="plain-syntax">,</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">kit</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">current_grammar_block</span><span class="plain-syntax">, </span><span class="identifier-syntax">slash_equivalence_class</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">eog_reserved_label</span><span class="plain-syntax"> = </span><a href="2-ec.html#SP17" class="function-link"><span class="function-syntax">EmitCode::reserve_label</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">L</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><a href="2-ec.html#SP14" class="function-link"><span class="function-syntax">EmitCode::inv</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">JUMP_BIP</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::down</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">        </span><a href="2-ec.html#SP17" class="function-link"><span class="function-syntax">EmitCode::lab</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">eog_reserved_label</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::up</span></a><span class="plain-syntax">();</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="7-cgl.html#SP14_5">&#167;14.5</a> (twice).</li></ul>
<nav role="progress"><div class="progresscontainer">
    <ul class="progressbar"><li class="progressprev"><a href="7-cg.html">&#10094;</a></li><li class="progresschapter"><a href="P-wtmd.html">P</a></li><li class="progresschapter"><a href="1-rm.html">1</a></li><li class="progresschapter"><a href="2-hrr.html">2</a></li><li class="progresschapter"><a href="3-gm.html">3</a></li><li class="progresschapter"><a href="4-enc.html">4</a></li><li class="progresschapter"><a href="5-act.html">5</a></li><li class="progresschapter"><a href="6-bd.html">6</a></li><li class="progresscurrentchapter">7</li><li class="progresssection"><a href="7-cg.html">cg</a></li><li class="progresscurrent">cgl</li><li class="progresssection"><a href="7-cgt.html">cgt</a></li><li class="progresssection"><a href="7-kg.html">kg</a></li><li class="progresssection"><a href="7-nft.html">nft</a></li><li class="progresssection"><a href="7-np.html">np</a></li><li class="progresssection"><a href="7-pnp.html">pnp</a></li><li class="progressnext"><a href="7-cgt.html">&#10095;</a></li></ul></div>
</nav><!-- End of weave -->

		</main>
	</body>
</html>

